﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Nav.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headContentPlaceHolder" Runat="Server">
    <%--<link href="layout.css" rel="stylesheet" type="text/css"></link>--%>
     <!--[if IE]><script language="javascript" type="text/javascript" src="js/excanvas.min.js"></script><![endif]-->
    <script language="javascript" type="text/javascript" src="js/jquery.flot.min.js"></script>
    <script language="javascript" type="text/javascript" src="js/jquery.flot.crosshair.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CenterBodyContentPlaceHolder" Runat="Server">
    <div id="content_middle" class="float_left">
        <div class="block">
            <div class="content_middle_top">
            </div>
            <div class="block_body">
                <h2>Win/Loss</h2>
                <div class="block_body_inner">
                <div id="placeholder" style="width:450px;height:170px"></div>
                    <%--<img runat="server" id="imgChart" src="~/images/embeded_chart.jpg" alt="chart" />--%>
                    <%--<object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
                        width="400px" height="150px">
                        <param name="source" value="ClientBin/SilverlightApplication12.xap" />
                        <param name="onError" value="onSilverlightError" />
                        <param name="background" value="white" />
                        <param name="minRuntimeVersion" value="3.0.40818.0" />
                        <param name="autoUpgrade" value="true" />
                        <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none">
                            <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
                                style="border-style: none" />
                        </a>
                    </object>
                    <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;
                        border: 0px"></iframe>--%>
                        <div>
                        
                        </div>
                </div>
            </div>
            <div class="content_middle_footer">
            </div>
        </div>
        <div class="block">
            <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
                width="100%" height="260px">
                <param name="source" value="ClientBin/EditorialAdministration.xap" />
                <param name="onError" value="onSilverlightError" />
                <param name="background" value="white" />
                <param name="minRuntimeVersion" value="3.0.40818.0" />
                <param name="autoUpgrade" value="true" />
                <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none">
                    <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
                        style="border-style: none" />
                </a>
            </object>
            <iframe id="Iframe1" style="visibility: hidden; height: 0px; width: 0px; border: 0px">
            </iframe>
            <%--<img runat="server" id="imgAppSample" src="~/images/sample.jpg" alt="sample" />--%>
        </div>
    </div>
    <div id="sidebar_right" class="float_right">
        <div class="sidebar_right_top">
        </div>
        <div class="block_body sidebar_right_body">
            <h2>
                Automation Details</h2>
            <div class="block_body">
                <p>
                    <span class="paragraph_title">Name:</span>
                    <label id="AppName">
                        EIA Natural Gas</label></p>
                <p>
                    <span class="paragraph_title">Frequecy</span>:
                    <label id="AppFrequecy">
                        Weekly</label></p>
                <p>
                    <span class="paragraph_title">Last Run On</span>:
                    <label id="AppLastRunOn">
                        Thursday, April 22nd, 2010</label></p>
                <p>
                    <span class="paragraph_title">Last Run By</span>:
                    <label id="AppLastRunBy">
                        Bill Yovino</label></p>
                <p>
                    <span class="paragraph_title">Owner</span>:
                    <label id="AppOwner">
                        Matt Robinson, EIC</label></p>
                <p>
                    <span class="paragraph_title">Last Software Update</span>:
                    <label id="AppLastUpdate">
                        Apri 1st, 2010</label></p>
                <p>
                    <span class="paragraph_title">Authorized Users</span>:
                    <ul id="AppUsers">
                        <li>Bill Yovino</li><li>Rashmi Jain</li><li>Simon Ye</li>
                    </ul>
                </p>
                <p>
                 <a id="lnkRA" style="display:none;" href="RequestAccess.aspx">Request Access</a>
                </p>
            </div>
        </div>
        <div class="sidebar_right_footer">
        </div>
    </div>
    <script type="text/javascript">

        function UpdateAppDetailsWithRA(appName) {
            UpdateAppDetails(appName);
            $('#lnkRA').fadeIn('slow');
        }
        function UpdateAppDetails(appName) {
            $('#lnkRA').fadeOut();
            for (var data in mockData.bindings) {
                if (appName == mockData.bindings[data].AppName) {
                    BindData(mockData.bindings[data]);
                    return;
                }
            }
            var defaultData = mockData.bindings[mockData.bindings.length - 1];
            defaultData.AppName = appName;
            BindData(defaultData);
        }
        var mockData = { "bindings": [
        { "AppName": "EIA Nature Gas", "AppFrequecy": "Weekly", "AppLastRunOn": "April 30th 2010", "AppLastRunBy": "Bill", "AppOwner": "Matt", "AppLastUpdate": "April 1st 2010", "AppUsers": ["ShangZhen", "Bill", "Rashmi"] },
        { "AppName": "EIA Petroleum", "AppFrequecy": "Monthly", "AppLastRunOn": "March 11th 2010", "AppLastRunBy": "Simon", "AppOwner": "Matt", "AppLastUpdate": "March 1st 2010", "AppUsers": ["Rashmi", "Simon"] },
        { "AppName": "EIA API", "AppFrequecy": "Daily", "AppLastRunOn": "May 6th 2010", "AppLastRunBy": "Rashmi", "AppOwner": "Richard", "AppLastUpdate": "March 11th 2010", "AppUsers": ["Bill", "Simon", "Rashmi"] },
        { "AppName": "EIA Oil Refinery", "AppFrequecy": "Monthly", "AppLastRunOn": "April 30th 2010", "AppLastRunBy": "Bill", "AppOwner": "Matt", "AppLastUpdate": "April 1st 2010", "AppUsers": ["Bill", "Simon"] },
        { "AppName": "Sample 1", "AppFrequecy": "Weekly", "AppLastRunOn": "April 15th 2010", "AppLastRunBy": "ShangZhen", "AppOwner": "Matt", "AppLastUpdate": "January 1st 2010", "AppUsers": ["Bill", "Simon", "Rashmi"] },
        { "AppName": "Sample 2", "AppFrequecy": "Weekly", "AppLastRunOn": "April 25th 2010", "AppLastRunBy": "Rashmi", "AppOwner": "Matt", "AppLastUpdate": "March 17th 2010", "AppUsers": ["Bill", "Rashmi"] },
        { "AppName": "Default", "AppFrequecy": "Daily", "AppLastRunOn": "April 15th 2010", "AppLastRunBy": "Bill", "AppOwner": "Matt", "AppLastUpdate": "March 17th 2010", "AppUsers": ["Bill", "Rashmi", "Simon"] }
        ]
    };

    function BindData(data) {
        ChangeField("AppName", data.AppName);
        ChangeField("AppFrequecy", data.AppFrequecy);
        ChangeField("AppLastRunOn", data.AppLastRunOn);
        ChangeField("AppLastRunBy", data.AppLastRunBy);
        ChangeField("AppOwner", data.AppOwner);
        ChangeField("AppLastUpdate", data.AppLastUpdate);
        ChangeUsers("AppUsers", data.AppUsers);
    }
        function ChangeUsers(labelName, labelValues) {
            var users = '';
            for (var lableValue in labelValues) {
                users += "<li>" + labelValues[lableValue] + "</li>";
            }
            ChangeField(labelName, users);
        }
        function ChangeField(labelName, labelValue) {

            $("#" + labelName).fadeOut("slow", function() {
                $("#" + labelName).html(labelValue);
                $("#" + labelName).css("color", "red");
            });

            $("#" + labelName).fadeIn("slow", function() {
                $("#" + labelName).css("color", "");
            });
        }
        
        
    </script>
<script id="source" language="javascript" type="text/javascript">
    var plot;
    $(function() {
        var sin = [], cos = [];
        for (var i = 1; i <= 12; i += 0.1) {
            sin.push([i, (2+Math.sin(i / 2))/4]);
            cos.push([i, Math.sin( 2+Math.cos((i+3)/4))/3]);
        }

        plot = $.plot($("#placeholder"),
                      [{ data: sin, label: "TR = -0.00" },
                        { data: cos, label: "BBG = -0.00"}], {
                            series: {
                                lines: { show: true }
                            },
                            crosshair: { mode: "x" },
                            grid: { hoverable: true, autoHighlight: false },
                            yaxis: { min: 0, max: 1 }
                        });
        var legends = $("#placeholder .legendLabel");
        legends.each(function() {
            // fix the widths so they don't jump around
            $(this).css('width', $(this).width());
        });

        var updateLegendTimeout = null;
        var latestPosition = null;

        function updateLegend() {
            updateLegendTimeout = null;

            var pos = latestPosition;

            var axes = plot.getAxes();
            if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||
            pos.y < axes.yaxis.min || pos.y > axes.yaxis.max)
                return;

            var i, j, dataset = plot.getData();
            for (i = 0; i < dataset.length; ++i) {
                var series = dataset[i];

                // find the nearest points, x-wise
                for (j = 0; j < series.data.length; ++j)
                    if (series.data[j][0] > pos.x)
                    break;

                // now interpolate
                var y, p1 = series.data[j - 1], p2 = series.data[j];
                if (p1 == null)
                    y = p2[1];
                else if (p2 == null)
                    y = p1[1];
                else
                    y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);

                legends.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));
            }
        }

        $("#placeholder").bind("plothover", function(event, pos, item) {
            latestPosition = pos;
            if (!updateLegendTimeout)
                updateLegendTimeout = setTimeout(updateLegend, 50);
        });
    });
</script>
</asp:Content>
